﻿<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<script type="text/javascript">
		$(document).ready(function(){
			//聚焦第一个输入框
			$("#enterCount").focus();
		});	
	//表单验证
	function volidate(){
		var enterCount=$("#enterCount").val();
  		var tryonCount=$("#tryonCount").val();
  		var tradeCount=$("#tradeCount").val();
  		var tradeAmount=$("#tradeAmount").val();
  		var result1 = $("#result1").attr("checked");
  		var result2 = $("#result2").attr("checked");
  		var result3 = $("#result3").attr("checked");
  		var reason = $("#reason").val();
		var name= $("#name").val();
		var phone= $("#phone").val();
		if($.trim(enterCount).length<1){
			alert("请输入进店人数!");	
			return false;
		}
		if(result1 && $.trim(tradeCount).length<1){
			alert("请输入成交人数!");	
			return false;
		}
		if(result1 && $.trim(tradeAmount).length<1){
			alert("请输入成交金额!");	
			return false;
		}

		if(result2 && $.trim(tryonCount).length<1){
			alert("请输入试穿人数!");	
			return false;
		}
		if($.trim(reason).length<1){
			alert("请输入导致结果原因!");	
			return false;
		}
		if(result3 && $.trim(name).length<1 ){
			alert("请输入顾客姓名!");	
			return false;
		}
		if(result3 && $.trim(phone).length<1 ){
			alert("请输入顾客电话!");	
			return false;
		}
		
    	return true;
	}
   
 </script>
 <div class="navbox">
	<div class="globalnav"> 
	    <a href="<%=request.getContextPath()%>/shopper/list" class="ed">
	    <span>进店统计</span>
	    </a> 
	    <a href="<%=request.getContextPath()%>/user/list">
	    <span>账号管理</span>
	    </a> 
    </div>
    <div class="subnav">
    	<a href="<%=request.getContextPath()%>/shopper/list" class="ed">
    		<span>今日进店</span>
    	</a>
    	<span class="line">|</span> 
   		<a href="<%=request.getContextPath()%>/shopper/query">
    		<span>进店统计</span>
    	</a>
    </div>
  </div>

  <!--     主体从这开始    -->
  <div class="container">
    <h2><span>添加进店记录</span></h2>
     <form action="${ctx}/shopper/save" method="post" id="form1" onsubmit="return volidate();">
     <table class="global_table" cellpadding="0" cellspacing="0"> 
      <tr> 
        <th style="width:110px;">进店人数：</th> 
        <td>
        <input type="text" id="enterCount" class="g_inp width100" onfocus="this.className='g_inp inn width100'" onblur="this.className='g_inp width100'" 
        		name="enterCount" value=""/>
        </td>
         <th style="width:110px;">试穿人数：</th>
        <td>
        	<input type="text" id="tryonCount" class="g_inp width100" onfocus="this.className='g_inp inn width100'" onblur="this.className='g_inp width100'" 
        		name="tryonCount" value=""/>
         </td>
      </tr>
        
       <tr>
         <th style="width:110px;">成交人数：</th>
        	<td>
        	<input type="text" id="tradeCount" class="g_inp width100" onfocus="this.className='g_inp inn width100'" onblur="this.className='g_inp width100'" 
        		name="tradeCount" value=""/>
         </td>
         
         <th style="width:110px;">成交金额：</th> 
        	<td>
        		<input type="text" id="tradeAmount" class="g_inp width100" onfocus="this.className='g_inp inn width100'" onblur="this.className='g_inp width100'" 
        			name="tradeAmount" value=""/>
      	</td> 
      </tr> 
      
      <tr>
      	 <th style="width:110px;">接待人：</th> 
        	<td>
        	<select name="receptionistId" class="width100" id="receptionistId">
        		<c:forEach items="${users}" var="u">
        			<option <c:if test="${user.id eq u.id}">selected="selected"</c:if> value="${u.id}">${u.name}</option>
        		</c:forEach>
          </select>
         </td> 
          <th style="width:110px;">协助人：</th> 
        	<td>
        	<select name="assistorId" class="width100" id="assistorId">
            	<option value="-1" selected="selected">无</option>
            	<c:forEach items="${users}" var="u">
            		<c:if test="${!(user.id eq u.id)}">
        				<option value="${u.id}">${u.name}</option>
        			</c:if>
        		</c:forEach>
          </select>
         </td> 
      </tr>
      
      <tr>
      	<th style="width:110px;">自然/经营性进店:</th> 
        <td>
        	<input type="radio" name="intoType" value="自然性进店" checked="checked"/><label>自然性进店</label>
        	&nbsp;&nbsp;
        	<input type="radio" name="intoType" value="经营性进店"/><label>经营性进店</label>
      	</td>
      	<th style="width:110px;">新/老顾客：</th> 
        <td>
        	<input type="radio" name="newOrOld" value="新顾客" checked="checked"/><label>新顾客</label>
        	&nbsp;&nbsp;
        	<input type="radio" name="newOrOld" value="老顾客"/><label>老顾客</label>
      	</td>  
      	</tr>
      	<tr>
        <th style="width:110px;">进店结果：</th> 
        <td colspan="3">
       		<input type="radio" name="result" id="result1" value="购买" checked="checked"/><label>购买</label>
       		&nbsp;&nbsp;
        	<input type="radio" name="result" id="result2" value="试穿" /><label>试穿</label>
        	&nbsp;&nbsp;
        	<input type="radio" name="result" id="result3" value="留下电话"/><label>留下电话</label>
        	&nbsp;&nbsp;
        	<input type="radio" name="result" id="result4" value="宣传产品"/><label>宣传产品</label>
        	&nbsp;&nbsp;
        	<input type="radio" name="result" id="result5" value="有沟通"/><label>有沟通</label>
        	&nbsp;&nbsp;
        	<input type="radio" name="result" id="result6" value="没有沟通"/><label>没有沟通</label>
        	&nbsp;&nbsp;
        	<input type="radio" name="result" id="result7" value="售后"/><label>售后</label>
      </td>
      </tr> 
      <tr>
      		<th style="width:110px;">导致结果原因：</th> 
        	<td>
        		<input type="text" id="reason" class="g_inp width320" onfocus="this.className='g_inp inn width320'" onblur="this.className='g_inp width320'" 
        			name="reason" value=""/>
      		</td> 
      		<th style="width:110px;">进店时间：</th> 
      		<td>
      		<input type="text" class="g_inp width150 Wdate" name="enterDate" readonly="readonly" id="enterDate" value="${today}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
     	</td>
      </tr>  
      <tr>
      		<th style="width:110px;">姓名：</th> 
        	<td>
        		<input type="text" id="name" class="g_inp width100" onfocus="this.className='g_inp inn width100'" onblur="this.className='g_inp width100'" 
        			name="name" value=""/>
      		</td>
      		<th style="width:110px;">电话：</th> 
        	<td>
        		<input type="text" id="phone" class="g_inp width100" onfocus="this.className='g_inp inn width100'" onblur="this.className='g_inp width100'" 
        			name="phone" value=""/>
      		</td> 
      </tr>
      <tr>
      	<th style="width:110px;">地址：</th> 
        <td colspan="3">
        	<input type="text" id="address" class="g_inp width100" onfocus="this.className='g_inp inn width100'" onblur="this.className='g_inp width100'" 
        			name="address" value=""/>
      	</td>
      </tr>
    </table> 
  
   <br />
    <center>
      <input type="submit" class="g_btn_blue" value="保  存" id="searchBtn"/>
      &nbsp; &nbsp; &nbsp;
      <input type="button" class="g_btn_blue2" value="返  回" onclick="javascript:history.back();"/>
    </center>
    </form>
  </div>
  <!--     主体 end    -->
  <!-- 统计代码 begin-->
  <!--统计代码 end-->
</body>
</html>
